/**
 * Copyright (C), 2015-2019, XXX有限公司
 * FileName: MenuServiceImpl
 * Author:   zhouheng
 * Date:     2019/6/8 23:40
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.zhouh.golden.system.service.impl;

import com.zhouh.golden.common.service.impl.BaseService;
import com.zhouh.golden.system.dao.MenuMapper;
import com.zhouh.golden.system.domain.Menu;
import com.zhouh.golden.system.service.MenuService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 〈一句话功能简述〉<br> 
 * 〈〉
 *
 * @author zhouheng
 * @create 2019/6/8
 * @since 1.0.0
 */
@Service
public class MenuServiceImpl extends BaseService<Menu> implements MenuService<Menu> {
    @Autowired
    private MenuMapper menuMapper;

    @Override
    public String findUserPermissions(String userName) {
        List<Menu> list = this.menuMapper.findUserPermissions(userName);
        return list.stream().map(Menu::getPerms).collect(Collectors.joining(","));
    }
}